package Interface;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import entity.Customer;

public class KioskGui extends JFrame implements ActionListener {

	private JLabel lblId;
	private JTextField txtId;
	private JLabel lblCarID;
	private JTextField txtCarID;
	private JButton btnCheckin;
	private JButton btnExit;
	//private JButton btn;
	
	
	public KioskGui() {
		
		setTitle("Kiosk Station");
		this.setSize(300, 184);
		this.getContentPane().setLayout(null);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		lblId = new JLabel("ID:");
		lblId.setBounds(60, 24, 20, 20);
		getContentPane().add(lblId);
		
		txtId = new JTextField();
		txtId.setBounds(124, 23, 98, 20);
		getContentPane().add(txtId);

		lblCarID = new JLabel("Car ID:");
		lblCarID.setBounds(49, 51, 100, 14);
		getContentPane().add(lblCarID);
		
		txtCarID = new JTextField();
		txtCarID.setBounds(124, 46, 98, 20);
		getContentPane().add(txtCarID);
		
		btnExit = new JButton("Exit");
		btnExit.setBounds(22, 98, 100, 23);
		getContentPane().add(btnExit);
		btnExit.addActionListener(this);
		
		btnCheckin = new JButton("Checkin");
		btnCheckin.setBounds(163, 98, 100, 23);
		getContentPane().add(btnCheckin);
		btnCheckin.addActionListener(this);
		
		this.setVisible(true);
		
		
		
		
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource() == btnCheckin) {
			if((txtId.getText().isEmpty()==false) && (txtCarID.getText().isEmpty()==false)) {
				new CreateOccasionalOrder();
				this.setVisible(false);
			}
			else
			{
				JOptionPane.showMessageDialog(this,"Please Enter ID and Password","Error",
					    JOptionPane.ERROR_MESSAGE);
			}
		}
		if(e.getSource() == btnExit) {
			System.exit(0);
		}
		
		
	}
	
	
	/*public void CheckInOrOut(Integer CarId, Integer OrderId) {
	}*/
	
}